package cn.explink.dop.enums;

import java.util.ArrayList;
import java.util.List;

/**
 * @author songkaojun
 *
 */
public enum OrderStatusEnum {

	NOT_ASSIGN(1, "未分配"), STORE_FRONT_NO_ACCEPT(2, "门店取消"), ASSIGNED(3, "已分配"), TO_DISTRIBUTE(4, "配送员接单"), DISTRIBUTE_REFUSE(5, "配送员拒绝"), RECEIVE_ORDER(6, "已领单"), READY_DILIVERY(7, "待配送"), SIGN_RECEIVE(
			8, "已签收"), REFUSE_RECEIVE(9, "已拒收"),OVERDUE(10,"已过期");

	private int value;

	private String text;

	private OrderStatusEnum(int value, String text) {
		this.value = value;
		this.text = text;
	}

	public int getValue() {
		return this.value;
	}

	public String getText() {
		return this.text;
	}

	public static List<OrderStatusEnum> getAllStatus() {
		List<OrderStatusEnum> orderStatusEnumList = new ArrayList<OrderStatusEnum>();
		orderStatusEnumList.add(NOT_ASSIGN);
		orderStatusEnumList.add(STORE_FRONT_NO_ACCEPT);
		orderStatusEnumList.add(ASSIGNED);
		orderStatusEnumList.add(TO_DISTRIBUTE);
		orderStatusEnumList.add(DISTRIBUTE_REFUSE);
		orderStatusEnumList.add(RECEIVE_ORDER);
		orderStatusEnumList.add(READY_DILIVERY);
		orderStatusEnumList.add(SIGN_RECEIVE);
		orderStatusEnumList.add(REFUSE_RECEIVE);
		orderStatusEnumList.add(OVERDUE);
		return orderStatusEnumList;
	}

	public static String getTextByValue(int value) {
		List<OrderStatusEnum> allStatus = OrderStatusEnum.getAllStatus();
		for (OrderStatusEnum orderStatusEnum : allStatus) {
			if (orderStatusEnum.getValue() == value) {
				return orderStatusEnum.getText();
			}
		}
		return "";
	}
}
